'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
  async index() {
    const { ctx } = this;
    ctx.body = 'hi, egg';
  }

  async banner() {
    const { ctx } = this;
    const bannerData = await ctx.service.home.banner();
    ctx.body = {
      code: 1,
      data: bannerData,
    };
  }

  async menu() {
    const { ctx } = this;
    const menuData = await ctx.service.home.menu();
    ctx.body = {
      code: 1,
      data: menuData,
    };
  }

  async tabmenu() {
    const { ctx } = this;
    const menuData = await ctx.service.home.tabmenu();
    ctx.body = {
      code: 1,
      data: menuData,
    };
  }
}

module.exports = HomeController;
